<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/vectrics.tld"    prefix="vectrics" %>
<%@ page import="org.vectrics.recruiter.config.*" %>

<%@ page import="org.vectrics.hibernate.ThreadProperties" %>
<%@ page import="org.vectrics.domain.Domain" %>

<%
	String domainId = ThreadProperties.getUriDomainId();
	Domain domain = ThreadProperties.getDomain();
	String formAction = "/public/" + domainId + "/newuser/save";

	boolean allowEmailPassword = RecruitConfig.getRecruitInstance().getAllowPasswordEmail(domain);
	boolean answerQuestionForEmailPassword = RecruitConfig.getRecruitInstance().getAnswerQuestionForEmailPassword(domain);
%>



<p class="stdFont">Please choose a user name and password (must be at least 6 characters).</p>

<jsp:useBean id="newUserLoginProfileForm" class="org.vectrics.recruiter.struts.NewUserLoginProfileForm" scope="request"/>

<table width="450">
	<tr>
		<td valign="middle" >
			<html:form action="<%=formAction%>" focus="userName" method="POST">
				<html:hidden property="userId"/>
				<input type="hidden" name="newPerson" value="true"/>
				<input type="hidden" name="newUser" value="true"/>
				<input type="hidden" name="allowEmailPass" value="true"/>
				
				<table width="100%">
					<tr>
						<td width="30%"></td>
						<td width="70%" valign="middle"  width="50%">
							<table>
								<tr>
									<td valign="middle"  width="50%">
										<font class="formLabelClass">User Name</font>
										<vectrics:errors property="userName"/>
									</td>
									<td valign="middle" >
										<html:text styleClass="formEditClass" property="userName"/>
										
									</td>
								</tr>
								<tr>
									<td valign="middle"  width="50%">
										<font class="formLabelClass">Password</font>
										<vectrics:errors property="password"/>
									</td>
									<td valign="middle" >
										<html:password styleClass="formEditClass" property="password"/>
									</td>
								</tr>
								<tr>
									<td valign="middle"  width="50%">
										<font class="formLabelClass">Confirmation Password</font>
										<vectrics:errors property="password2"/>
									</td>
									<td valign="middle" >
										<html:password styleClass="formEditClass" property="password2"/>
									</td>
								</tr>
								<tr>
									<td valign="middle"  width="50%">
										<font class="formLabelClass">E-Mail</font>
										<vectrics:errors property="email"/>
									</td>
									<td valign="middle" >
										<html:text styleClass="formEditClass" property="email"/>
									</td>
								</tr>
								
								<tr>
									<td valign="middle"  width="50%">
										<font class="formLabelClass">First Name</font>
										<vectrics:errors property="firstName"/>
									</td>
									<td valign="firstName" >
										<html:text styleClass="formEditClass" property="firstName"/>
									</td>
								</tr>
								
								<tr>
									<td valign="middle"  width="50%">
										<font class="formLabelClass">Last Name</font>
										<vectrics:errors property="lastName"/>
									</td>
									<td valign="middle" >
										<html:text styleClass="formEditClass" property="lastName"/>
									</td>
								</tr>

					<% 	
						if ((answerQuestionForEmailPassword) && (allowEmailPassword)) { %>
								
								<tr>
									<td valign="middle">
										<font class="formLabelClass"><bean:message key="prompt.hint.question"/></font>
										<vectrics:errors property="hintQuestionCode"/>
									</td>
									<td valign="middle" >
										<html:select name="newUserLoginProfileForm" property="hintQuestionCode" styleClass="formComboClass">
										  <html:options collection="hintQuestions" labelProperty="text" property="code"/>
										</html:select>
									</td>
								</tr>
								
								<tr>
									<td valign="middle">
										<font class="formLabelClass"><bean:message key="prompt.hint.answer"/></font>
										<vectrics:errors property="hintAnswer"/>
									</td>
									<td valign="middle" >
										<html:text styleClass="formEditClass" property="hintAnswer"/>
									</td>
								</tr>
					<% } %>
								
								<tr>
									<td valign="TOP" align="left"></td>
									<td valign="TOP" align="left">
										<vectrics:formButton name="submit" code="public.button.ok" phraseCode="button.ok"/>
										&nbsp;
										<vectrics:formButton name="cancel" code="public.button.cancel" phraseCode="button.cancel"/>
										
									</td>
								</tr>
								
							</table>
						</td>
					</tr>
				</table>
			</html:form>
		</td>
	</tr>
</table>
